The HIST_EQUAL function returns a histogram-equalized byte array.
The HISTOGRAM function is used to obtain the density distribution of the input array. The histogram is integrated to obtain the cumulative density-probability function and finally the lookup function is used to transform to the output image.
Note: The first element of the histogram is always zeroed to remove the background.
This routine is written in the IDL language. Its source code can be found in the file hist_equal.pro in the lib subdirectory of the IDL distribution.
Result = HIST_EQUAL( A [, BINSIZE=value] [, FCN=vector] [, /HISTOGRAM_ONLY] [, MAXV=value] [, MINV=value] [, OMAX=variable] [, OMIN=variable] [, PERCENT=value] [, TOP=value] )
This function returns a histogram-equalized array of type byte, with the same dimensions as the input array. If the HISTOGRAM_ONLY keyword is set, then the output will be a vector of type LONG.
The array to be histogram-equalized.
Set this keyword to the size of the bin to use. The default is BINSIZE=1 if A is a byte array, or, for other input types, the default is (MAXV – MINV)/5000.
Set this keyword to the desired cumulative probability distribution function in the form of a 256-element vector. If a probability distribution function is not supplied, IDL uses a linear ramp, which yields equal probability bin results. This function is later normalized, so magnitude is inconsequential; the function should, however, increase monotonically.
Set this keyword to return a vector of type LONG containing the cumulative distribution histogram, rather than the histogram equalized array.
Set this keyword to the maximum value to consider. The default is 255 if A is a byte array, otherwise the maximum data value is used. Input elements greater than or equal to MAXV are output as 255.
Set this keyword to the minimum value to consider. The default is 0 if A is a byte array, otherwise the minimum data value is used. Input elements less than or equal to MINV are output as 0.
Set this keyword to a named variable that, upon exit, will contain the maximum data value used in constructing the histogram.
Set this keyword to a named variable that, upon exit, will contain the minimum data value used in constructing the histogram.
Set this keyword to a value between 0 and 100 to stretch the image histogram. The histogram will be stretched linearly between the limits that exclude the PERCENT fraction of the lowest values, and the PERCENT fraction of the highest values. This is an automatic, semi-robust method of contrast enhancement.
The maximum value of the scaled result. If TOP is not specified, 255 is used. Note that the minimum value of the scaled result is always 0.
Create a sample image using the DIST function and display it:
image = DIST(100)
TV, image
Create a histogram-equalized version of the byte array, image, and display the new version. Use a minimum input value of 10, a maximum input value of 200, and limit the top value of the output array to 220:
new = HIST_EQUAL(image, MINV = 10, MAXV = 200, TOP = 220)
TV, new
Note: See “Working with Histograms” (Chapter 8, Image Processing in IDL) in the help/pdf
directory of the IDL installation.
Original |
Introduced |
ADAPT_HIST_EQUAL , H_EQ_CT , H_EQ_INT , HIST_2D , HISTOGRAM